/*****************************************************************************
 *
 * Copyright (c), 2004-2020,ShangHai Neotune Information Technology Co., Ltd.
 *
 * Module Name : v3_priv.h
 *
 * Author :    sean
 *
 * Date :    2004-02-05
 *
 * Version :    1.00
 *
 * Description :    
 *
 * Other :    
 *
 * Data Structure List: <Main Data Structure>
 *
 * Modification History
 * ---------------------------------------------------------------------------
 *  1: Data :      2004-02-05
 *    Author :     sean
 *    Version :    V100R001M00
 *    Modification : creation
 *
*****************************************************************************/


#if (!defined(v3_priv_inc))
#define v3_priv_inc

#ifdef __cplusplus
extern"C" {
#endif

#if (!defined(asn1_inc))
#include <asn1.h>
#endif

typedef ALENGTH_T (V3_PRIV_SIZE_T)   __((ptr_t, ALENGTH_T));
typedef int       (V3_PRIV_ENCODE_T) __((bits8_t *, ALENGTH_T, sbits32_t, 
                                         bits8_t *, ALENGTH_T,
                                         bits8_t *, bits8_t *));
typedef int       (V3_PRIV_DECODE_T) __((bits8_t *, ALENGTH_T,
                                         bits8_t *, ALENGTH_T,
                                         bits8_t *, bits8_t *));

#ifdef NEOSNET_STRUCT_ALIGN
#pragma align 1
#endif

typedef struct SNMP_PRIV_S
        {
        struct SNMP_PRIV_S *next;
        OBJ_ID_T            name;       /* name of the priv protocol */
        V3_PRIV_SIZE_T     *size;       /* routine to calculate the size */
        V3_PRIV_ENCODE_T   *encode;     /* routine to encode */
        V3_PRIV_DECODE_T   *decode;     /* routine to decode */
        ALENGTH_T           need;       /* space required for priv stuff */
        ALENGTH_T keysize;              /* space required for the key */
        } SNMP_PRIV_T;

#ifdef NEOSNET_STRUCT_ALIGN
#pragma align 0
#endif


/* global root pointer for the auth list */
extern SNMP_PRIV_T *v3_priv_root;

extern SNMP_PRIV_T * SNMP_Priv_Find    __((int, OIDC_T *));
extern int           SNMP_Priv_Add     __((SNMP_PRIV_T *));
extern int           SNMP_Priv_Add_DES __((void));

#define SNMP_Priv_Size(P, PKT, SL)          (((P)->size)((PKT), (SL)))
#define SNMP_Priv_Encode(P, K, KL, BT, B, BL, SP, OP) \
        (((P)->encode)((K), (KL), (BT), (B), (BL), (SP), (OP)))
#define SNMP_Priv_Decode(P, K, KL, B, BL, SP, OP) \
        (((P)->decode)((K), (KL), (B), (BL), (SP), (OP)))

#define SNMP_Priv_Get_KeySize(P) ((P)->keysize)
#define SNMP_Priv_Get_Need(P)    ((P)->need)

#define SNMP_Priv_Get_Name(P)    (&((P)->name))

extern OIDC_T      v3_priv_nopriv[];
extern int         v3_priv_nopriv_size;

extern SNMP_PRIV_T v3_priv_des;

#ifdef __cplusplus
}
#endif

#endif /* #if (!defined(v3_priv_inc)) */
